package cn.iocoder.yudao.module.trade.delivery.vo;

import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.region.RegionUtils;
import cn.iocoder.yudao.framework.region.vo.setter.CountyAutoSetter;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Schema(description = "管理后台 - 自提门店精简信息 Response VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DeliveryPickUpStoreSimpleRespVO implements CountyAutoSetter {

    @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23128")
    private Long id;

    @Schema(description = "店铺编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23128")
    private Long shopId;

    @Schema(description = "门店名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
    private String name;

    @Schema(description = "门店手机", requiredMode = Schema.RequiredMode.REQUIRED, example = "1528516029")
    private String phone;

    @Schema(description = "区域编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18733")
    private Integer areaId;

    @Schema(description = "门店详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "复旦大学路 188 号")
    private String detailAddress;

    @Schema(description = "省份编码", example = "520000")
    private String provinceCode;

    @Schema(description = "省份名称", example = "贵州省")
    private String provinceName;

    @Schema(description = "城市编码", example = "520100")
    private String cityCode;

    public String getCountyCode() {
        if (StrUtil.isBlank(countyCode)) {
            return RegionUtils.convertRegionIdToCode(getAreaId());
        }
        return countyCode;
    }

    @Schema(description = "城市名称", example = "贵阳市")
    private String cityName;

    @Schema(description = "区县编码", example = "520100")
    private String countyCode;

    @Schema(description = "区县名称", example = "南明区")
    private String countyName;

    @Schema(description = "完整地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "贵州省贵阳市南明区花果园金融街5号驰通集团公司")
    private String fullAddress;

    @SuppressWarnings("unused")
    public String getFullAddress() {
        return getProvinceName() + getCityName() + getCountyName() + getDetailAddress();
    }

    @Schema(description = "绑定用户编号组数", requiredMode = Schema.RequiredMode.REQUIRED, example = "23128")
    private List<Long> verifyUserIds;

}
